package com.ruoyi.system.service.impl;

import com.ruoyi.system.domain.MonitorVideo;
import com.ruoyi.system.mapper.MonitorVideoMapper;
import com.ruoyi.system.service.MonitorVideoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (MonitorVideo)表服务实现类
 *
 * @author makejava
 * @since 2020-10-15 15:20:08
 */
@Service
public class MonitorVideoServiceImpl implements MonitorVideoService {
    @Resource
    private MonitorVideoMapper monitorVideoDao;

    /**
     * 添加监控
     *
     * @param monitorVideo 要监控的视频
     */
    @Override
    public void addMonitorVideo(MonitorVideo monitorVideo, String openId, String name, String userId) {
        monitorVideo.setStatus(0);
        monitorVideo.setOpen_id(openId);
        monitorVideo.setCreate_time(null);
        monitorVideo.setName(name);
        monitorVideo.setUser_id(userId);
        monitorVideoDao.addMonitorVideo(monitorVideo);
    }

    @Override
    public List<MonitorVideo> selectAll() {

        return monitorVideoDao.selectAll();
    }

    @Override
    public List<MonitorVideo> selectAllByUserId(String userId) {

        return monitorVideoDao.selectAllByUserId(userId);
    }

    /**
     * 判断是否已经缓存
     *
     * @param itemId
     * @return
     */
    @Override
    public List<MonitorVideo> isBind(String itemId) {
        return monitorVideoDao.isBind(itemId);
    }
}
